More queue casting
authorRobert Lipe <robertlipe@gpsbabel.org>
Sat, 7 Jul 2018 04:20:18 +0000 (23:20 -0500)
committerRobert Lipe <robertlipe@gpsbabel.org>
Sat, 7 Jul 2018 04:20:18 +0000 (23:20 -0500)
This doesn’t _really_ help improve the code; this is to get a passing
presubmit from codify.

igc.cc
mapsource.cc
psitrex.cc

diff --git a/igc.cc b/igc.cc
index 5b67348895480c247ed94520fa56ff051730bf6e..2116ac4f3838a987ed206d0e7ef01cba3d0af9bb 100644 (file)
--- a/igc.cc
+++ b/igc.cc
@@ -892,9 +892,9 @@ static void wr_track()
     }
     // Iterate through waypoints in both tracks simultaneously
     QUEUE_FOR_EACH(&gnss_track->waypoint_list, elem, tmp) {
-      Waypoint* wpt = (Waypoint*) elem;
-      double pres_alt = interpolate_alt(pres_track, wpt->GetCreationTime().toTime_t() + time_adj);
-      wr_fix_record(wpt, (int) pres_alt, (int) wpt->altitude);
+      // FIXME(NEW_Q): the excessive casting of the iterators is gross. Rethink.
+      double pres_alt = interpolate_alt(pres_track, ((Waypoint*) elem)->GetCreationTime().toTime_t() + time_adj);
+      wr_fix_record(((Waypoint*) elem), (int) pres_alt, (int) ((Waypoint*)elem)->altitude);
     }
   } else {
     if (pres_track) {
index 118cd05f55b9bba74494278e5ef581c36e56d8db..b49a393036b605c655fe130a6a1051b2a9733aed 100644 (file)
@@ -139,7 +139,8 @@ mps_find_wpt_q_by_name(const queue* whichQueue, const QString& name)
   queue* elem, *tmp;
 
   QUEUE_FOR_EACH(whichQueue, elem, tmp) {
-    Waypoint* waypointp = (Waypoint*) elem;
+    void* vwaypointp = static_cast<void*>(elem);
+    Waypoint* waypointp = static_cast<Waypoint*>(vwaypointp);
     if (waypointp->shortname == name) {
       return waypointp;
     }
index 0a1d4319feab02192246ddf315f75419e1891fcc..be0e15088665f64e1f520f28eb56c6855922d129 100644 (file)
@@ -456,8 +456,6 @@ psit_routehdr_w(gbfile* psit_file, const route_head* rte)
 {
   QString rname;
 
-  Waypoint* testwpt;
-
   /* total nodes (waypoints) this route */
   if (rte->waypoint_list.next) { 
     // this test doesn't do what I w ant i.e test if this is a valid